-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX QuerySort::sort method should support sorting for multi arguments #563
FIX QuerySort::sort method should support sorting for multi arguments #563
Conversation
eacca89
to
438c1a1
Compare
@@ -631,6 +668,62 @@ public function testFieldAliases() | |||
$this->assertResult('readOneDataObjectFake.author', null, $result); | |||
} | |||
|
|||
public function provideFilterAndSortOnlyRead(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add one more test case for SortPlugin here.
5f2f79c
to
64bdd35
Compare
@@ -7,7 +7,7 @@ | |||
"php": "^7.4 || ^8.0", | |||
"silverstripe/framework": "^4.11", | |||
"silverstripe/vendor-plugin": "^1.0", | |||
"webonyx/graphql-php": "^14.0", | |||
"webonyx/graphql-php": "^14.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this to pass --prefer-lowest
CI. Since in 14.0.0 FieldDefinition
doesn't have getName()
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, just a couple small things to tidy up
64bdd35
to
5781c46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, tests are green here and were green when running against CMS 5 CI as well.
Description
Even if a method receives several parameters, then sorting occurs by the field of the arguments that is last specified in the schema, and not in the passed parameters. That is, if
SilverStripe\GraphQL\Tests\Fake\DataObjectFake
has the following schemaand sorting is required
AuthorID => DESC, myField => ASC
, then sorting was done only byAuthorID
, since in the schema this field is indicated after myField.Therefore, the call
$list->sort()
must be completed after all the necessary processing has been carried out.Parent issue